/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pass_client.admin;
import pasremote.PASRemote;
import pass_client.LoginFrame;

/**
 *
 * @author east429sara
 */
public class AdminFrame extends javax.swing.JFrame {
    private final PASRemote bean;

    

    public AdminFrame(PASRemote bean) {
        this.bean = bean;
        initComponents();
        initUserComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton2 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        btnNewAssign = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        btnRefresh = new javax.swing.JButton();
        btnLogout = new javax.swing.JButton();
        assignmentListPanel1 = new pass_client.admin.AssignmentListPanel();

        jButton2.setText("jButton2");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("PAS System for Administrator");

        jPanel1.setLayout(new java.awt.GridLayout(1, 0));
        getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);

        jPanel2.setLayout(new java.awt.BorderLayout());

        btnNewAssign.setText("New Assignment");
        btnNewAssign.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewAssignActionPerformed(evt);
            }
        });
        jPanel3.add(btnNewAssign);

        jPanel2.add(jPanel3, java.awt.BorderLayout.WEST);

        btnRefresh.setText("Refresh");
        btnRefresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshActionPerformed(evt);
            }
        });
        jPanel4.add(btnRefresh);

        btnLogout.setText("Logout");
        btnLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLogoutActionPerformed(evt);
            }
        });
        jPanel4.add(btnLogout);

        jPanel2.add(jPanel4, java.awt.BorderLayout.EAST);

        getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
        getContentPane().add(assignmentListPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshActionPerformed
        assignmentListPanel1.refresh(bean);
    }//GEN-LAST:event_btnRefreshActionPerformed

    private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogoutActionPerformed
        LoginFrame loginFrame = new LoginFrame(bean);
        this.dispose();
    }//GEN-LAST:event_btnLogoutActionPerformed

    private void btnNewAssignActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewAssignActionPerformed
        ProblemFrame problemFrame = new ProblemFrame(bean, Long.valueOf(-1));
    }//GEN-LAST:event_btnNewAssignActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private pass_client.admin.AssignmentListPanel assignmentListPanel1;
    private javax.swing.JButton btnLogout;
    private javax.swing.JButton btnNewAssign;
    private javax.swing.JButton btnRefresh;
    private javax.swing.JButton jButton2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    // End of variables declaration//GEN-END:variables

    private void initUserComponents() {
        setLocationByPlatform(true);
        setSize(500, 500);
        setVisible(true);    
        assignmentListPanel1.refresh(bean);
    }

}
